#include "static.h"
#include <windows.h>

using namespace shared;

typedef SharedObject* (__stdcall *CreateFunc)();
typedef void (__stdcall *ReleaseFunc)(SharedObject*);

void*	handle_ = NULL;

SharedObject* createSharedObject()
{
	void*	handle_ = ::LoadLibrary("shared.dll");
	if(!handle_)
		return NULL;
			
	CreateFunc c = (CreateFunc)::GetProcAddress((HMODULE)handle_,"createObject");
	return c();				
}

void releaseSharedObject(SharedObject* obj)
{
	if(obj && handle_)
	{
		ReleaseFunc r = (ReleaseFunc)::GetProcAddress((HMODULE)handle_,"releaseObject");
		r(obj);	
		::FreeLibrary((HMODULE)handle_);	
	}
}